OpenResultset Method (Remote Data)

       

Creates a new rdoResultset object.

Syntax

Set variable = connection.OpenResultset(name [,type [,locktype [,option]]])

Set variable = object.OpenResultset([type [,locktype [, option]]])

The OpenResultset method syntax has these parts:

Part Description
variable An object expression that evaluates to an rdoResultset object.
connection An object expression that evaluates to an existing rdoConnection object you want to use to create the new rdoResultset.
object An object expression that evaluates to an existing rdoQuery or rdoTable object you want to use to create the new rdoResultset.
name A String that specifies the source of the rows for the new rdoResultset. This argument can specify the name of an rdoTable object, the name of an rdoQuery, or an SQL statement that might return rows.
type A Variant or constant that specifies the type of cursor to create as indicated in Settings.
locktype A Variant or constant that specifies the type of concurrency control. If you don’t specify a locktype, rdConcurReadOnly is assumed.
option A Variant or constant that specifies characteristics of the new rdoResultset.

Settings

type Constant Value Description
rdOpenForwardOnly 0 (Default) Opens a forward-only-type rdoResultset object.
rdOpenKeyset 1 Opens a keyset-type rdoResultset object.
rdOpenDynamic 2 Opens a dynamic-type rdoResultset object.
rdOpenStatic 3 Opens a static-type rdoResultset object.

locktype Constant Value Description
rdConcurReadOnly 1 (Default) Read-only .
rdConcurLock 2 Pessimistic concurrency.
rdConcurRowVer 3 Optimistic concurrency based on row ID.
rdConcurValues 4 Optimistic concurrency based on row values.
rdConcurBatch 5 Optimistic concurrency using batch mode updates. Status values returned for each row successfully updated.

Constant Value Description
rdAsyncEnable 32 Execute operation asynchronously.
rdExecDirect 64 (Default.) Bypass creation of a stored procedure to execute the query. Uses SQLExecDirect instead of SQLPrepare and SQLExecute.

Remarks

If the OpenResultset method succeeds, RDO instantiates a new rdoResultset object and appends it to the rdoResultsets collection – even if no rows are returned by the query. If the query fails to compile or execute due to a syntax error, permissions problem or other error, the rdoResultset is not created and a trappable error is fired. The rdoResultset topic contains additional details on rdoResultset behavior and managing the rdoResultsets collection.

Note   RDO 2.0 behaves differently than RDO 1.0 in how it handles orphaned references to rdoResultset objects. When you Set a variable already assigned to an rdoResultset object with another rdoResultset object using the OpenResultset method, the existing rdoResultset object is closed and dropped from the rdoResultsets collection. In RDO 1.0, the existing object remained open and was left in the rdoResultsets collection.

Note   Before you can use the name of a base table in the name argument, you must first use the Refresh method against the rdoTables collection to populate it. You can also populate the rdoTables collection by referencing one of its members by its ordinal number. For example, referencing rdoTables(0) will populate the entire collection.

Executing Multiple Operations on a Connection

If there is an unpopulated rdoResultset pending on a data source that can only support a single operation on an rdoConnection object, you cannot create additional rdoQuery or rdoResultset objects using the OpenResultset method, or use the Refresh method on the rdoTable object until the rdoResultset is flushed, closed, or fully populated. For example, when using SQL Server 4.2 as a data source, you cannot create an additional rdoResultset object until you move to the last row of the last result set of the current rdoResultset object. To populate the result set, use the MoreResults method to move through all pending result sets, or use the Cancel or Close method on the rdoResultset to flush all pending result sets.